﻿//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NetCMS.Content;

public partial class mycom_up : NetCMS.Web.UI.UserPage
{
    Ghistory inf = new Ghistory();
    Sys sd = new Sys();
    protected void Page_Load(object sender, EventArgs e)
    {
        
        Response.CacheControl = "no-cache";
        string Commid = Request.QueryString["Commid"];
        DataTable dt = inf.sel_sysUser(Commid,4);
        this.TitleBox.Text=dt.Rows[0]["Title"].ToString();
        this.ContentBox.Text=dt.Rows[0]["Content"].ToString();
    }   
    protected void shortCutsubmit(object sender, EventArgs e)
    {
        if (Page.IsValid)//判断是否通过验证
        {
            string Title=Request.Form["TitleBox"].ToString();
            string Contents=Request.Form["ContentBox"].ToString();
            if (Contents.Length > 200)
            {
                PageError("评论内容最多200个字符。", "mycom.aspx");
            }
            DateTime CreatTime = DateTime.Now;
            string Commid = Request.QueryString["Commid"];
            int islocks = 0;
            DataTable isl = sd.UserPram();
            if (isl != null && isl.Rows.Count > 0)
            {
                if (NetCMS.Common.Input.IsInteger(isl.Rows[0]["CommCheck"].ToString()))
                {
                    islocks = int.Parse(isl.Rows[0]["CommCheck"].ToString());
                }
                isl.Clear(); isl.Dispose();
            }
            if (islocks != 1)
            {
                islocks = 2;
            }

            if (inf.update_apiCommentary(Title, Contents, CreatTime, Commid, islocks) == 0)
            {
                PageError("修改错误", "mycom.aspx");
            }
            else
            {
                PageRight("修改成功,可能需要重新审核！", "mycom.aspx");
            }
        }
    }
}
